home *** CD-ROM | disk | FTP | other *** search
/ Computer Arts: Pro Software Skills - Photoshop / Computer Arts Pro Software Skills Photoshop.iso / pc / main.swf / scripts / DefineSprite_177 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-06  |  1.6 KB  |  79 lines

  1. function setImageList(lst)
  2. {
  3.    trace(lst);
  4.    imgList = lst;
  5. }
  6. function nextImage()
  7. {
  8.    if(selectedImage < imgList.length - 1)
  9.    {
  10.       selectedImage += 1;
  11.    }
  12.    else
  13.    {
  14.       selectedImage = 0;
  15.    }
  16.    loadLargeImage(selectedImage);
  17. }
  18. function previousImage()
  19. {
  20.    if(selectedImage > 0)
  21.    {
  22.       selectedImage -= 1;
  23.    }
  24.    else
  25.    {
  26.       selectedImage = imgList.length - 1;
  27.    }
  28.    loadLargeImage(selectedImage);
  29. }
  30. function loadLargeImage(imgNum)
  31. {
  32.    iName = imgList[imgNum];
  33.    prefix = iName.split(".")[0];
  34.    pName = prefix + "_large.jpg";
  35.    mcl.loadClip(pName,imgHolder);
  36. }
  37. var imgList = new Array();
  38. var selectedImage = 0;
  39. ow = 858;
  40. oh = 608;
  41. var mclListener = new Object();
  42. mclListener.onLoadComplete = function(target_mc)
  43. {
  44.    target_mc.forceSmoothing = true;
  45. };
  46. mclListener.onLoadInit = function(mc)
  47. {
  48.    var _loc3_ = 858;
  49.    var _loc2_ = 608;
  50.    if(mc._width > mc._height)
  51.    {
  52.       ratio = mc._height / mc._width;
  53.       mc._width = _loc3_;
  54.       mc._height = _loc3_ * ratio;
  55.       if(mc._height > _loc2_)
  56.       {
  57.          mc._height = _loc2_;
  58.          mc._width = mc._height / ratio;
  59.       }
  60.       mc._x = (_loc3_ - mc._width) / 2;
  61.       mc._y = (_loc2_ - mc._height) / 2;
  62.    }
  63.    else
  64.    {
  65.       ratio = mc._width / mc._height;
  66.       mc._height = _loc2_;
  67.       mc._width = _loc2_ * ratio;
  68.       if(mc._width > _loc3_)
  69.       {
  70.          mc._width = _loc3_;
  71.          mc._height = mc._width / ratio;
  72.       }
  73.       mc._x = (_loc3_ - mc._width) / 2;
  74.       mc._y = (_loc2_ - mc._height) / 2;
  75.    }
  76. };
  77. var mcl = new MovieClipLoader();
  78. mcl.addListener(mclListener);
  79.